import matplotlib.pyplot as plt  # 导入pyplot模块
plt.rcParams['font.sans-serif'] = ['SimHei']  # 解决中文乱码问题
plt.rcParams['axes.unicode_minus'] = False  # 解决正负号乱码问题
days = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12','13','14','15'] # 准备月份信息
#max_temps = [2, 6, 14, 21, 28, 31, 32, 31, 26, 19, 10, 4] # 准备平均最高温度数据
#min_temps = [-7, -5, 2, 9, 16, 20, 24, 22, 17, 9, 1, -5] # 准备平均最低温度数据
min_temps = [22, 23, 24, 25, 24, 25, 24, 23, 22, 23, 24, 25, 24, 23, 22]
max_temps = [29, 30, 31, 32, 33, 34, 31, 30, 29, 30, 32, 33, 31, 30, 29]
plt.figure(figsize=(10, 5), dpi=80)
plt.grid(linestyle=":", alpha=0.5) # 添加画布网格
plt.xlabel("天") # 添加x轴标签
plt.ylabel("温度（单位：℃）") # 添加y轴标签
plt.title("清远市未来15天的最低温和最高温折线图·") # 添加图表标题
plt.plot(days, max_temps,'o-', color="r", label="平均最高温度",markersize=8,
         markerfacecolor='white',markeredgecolor='red') # 绘制平均最高温度折线图
plt.plot(days, min_temps, 'o-',color="b", label="平均最低温度",markersize=8,
         markerfacecolor='white',markeredgecolor='blue') # 绘制平均最低温度折线图
plt.legend() # 绘制图例，需要先在绘制曲线的同时，添加曲线的label标签

plt.show()